package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.dao.OrderSettinglistServiceDao;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.Members;
import com.itheima.pojo.User;
import com.itheima.service.OrderSettinglistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service(interfaceClass = OrderSettinglistService.class)
public class OrderSettinglistServiceImpl implements OrderSettinglistService {
    @Autowired
    private OrderSettinglistServiceDao orderSettinglistServiceDao;

    @Override
    public PageResult findPage(QueryPageBean queryPageBean) {
        Integer currentPage = queryPageBean.getCurrentPage();
        Integer pageSize = queryPageBean.getPageSize();
        String queryString = queryPageBean.getQueryString();
        PageHelper.startPage(currentPage,pageSize);
        Page<CheckGroup> page = orderSettinglistServiceDao.findPage(queryString);
        return new PageResult(page.getTotal(),page.getResult());
    }
    @Override
    public void add(Members member) {
        orderSettinglistServiceDao.add(member);
    }
    @Override
    public void update(Members member) {
        orderSettinglistServiceDao.update(member);
    }
    @Override
    public Members findById(Integer id) {
        return orderSettinglistServiceDao.findById(id);
    }
    @Override
    public void delete(Integer id) {
        orderSettinglistServiceDao.delete(id);
    }

    @Override
    public List<User> findOrder() {
        return orderSettinglistServiceDao.findOrder();
    }

}
